package javachongkao.面向对象上.程序填空题1;

import java.util.ArrayList;
//7-17 程序填空题1
//分数 5
//作者 hys
//单位 吉首大学
//以下程序不完整，请你补全代码，已经给定的代码无误，不允许修改。
//
//import java.util.ArrayList;
//
//public class Main{
//private ArrayList slist = new ArrayList();
//
//    public void addStudent(Student s){
//        this.slist.add(s);
//    }
//
//    public void showStudent(){
//        for(Student s:slist){
//            System.out.println(s);
//        }
//    }
//
//    public static void main(String[] args) {
//        Main t = new Main();
//        t.addStudent(new Student("2016001","rose",18));
//        t.addStudent(new Student("2016002","hunifu",19));
//        t.addStudent(new Student("2016003","britsh",20));
//        t.addStudent(new Student("2016004","sunni",17));
//        t.showStudent();
//    }
//}
//
//class Student {
//    //补全代码处
//}
//### 输入格式:
//
//无
//
//### 输出格式:
//
//无
//
//### 输入样例:
//
//
//```in
//
//```
//
//### 输出样例:
//
//```out
//2016001 rose 18
//2016002 hunifu 19
//2016003 britsh 20
//2016004 sunni 17
//```
public class Main {
    private ArrayList slist = new ArrayList();

    public void addStudent(Student s){
        this.slist.add(s);
    }

    public void showStudent(){
        for(Object s:slist){
            System.out.println(s);
        }
    }

    public static void main(String[] args) {
        Main t = new Main();
        t.addStudent(new Student("2016001","rose",18));
        t.addStudent(new Student("2016002","hunifu",19));
        t.addStudent(new Student("2016003","britsh",20));
        t.addStudent(new Student("2016004","sunni",17));
        t.showStudent();
    }
}

class Student {
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
    private String id;
    private String name;
    private int age;

    public Student(String id, String name, int age) {
        this.id = id;
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return id + " " + name + " " + age;
    }
}